<template>
  <div>
    <h2 style="text-align: center">审核列表</h2>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="signUserName"
        label="申请人"
        width="180">
      </el-table-column>
      <el-table-column
        prop="leaseStartTime"
        label="起租日期"
        width="180">
      </el-table-column>
      <el-table-column
        prop="leaseEndTime"
        label="结束日期">
      </el-table-column>
      <el-table-column
        prop="premiseName"
        label="小区">
      </el-table-column>
      <el-table-column
        prop="reserve2"
        label="状态">
        <template v-slot="scope">
          {{scope.row.reserve2 == 0 ? '审核中' : scope.row.reserve2 == 1 ? '已通过' : '已驳回'}}
        </template>
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作"
        v-if="flag"
        width="100">
        <template slot-scope="scope">
          <el-button v-if="scope.row.reserve3 != 'admin'" @click="execution(scope.row.id)" type="text" size="small">审批</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import * as sf from '@/api/harvest/sf.js';
import {execution, noFinished, unFinished} from "../../../api/harvest/sf";
export default {
  name: "Process",
  data(){
    return{
      tableData: [],
      contractForm: {},
      flag: true
    }
  },
  methods:{
    noFinished(){
      sf.noFinished().then(res=>{
        this.tableData = res.data;
          sf.unFinished().then(res=>{
            this.tableData = res.data;
          })
      })
    },
    execution(id){
      sf.execution(id).then(res=>{
        this.$message.success("审核通过");
        this.noFinished();
      })
    },
  },
  mounted() {
    this.noFinished();
    this.contractForm = this.$route.params.contractForm;
  }
}
</script>

<style scoped>

</style>
